/*
 * Copyright 2025 The JA-SIG Collaborative. All rights reserved.
 * distributed with this file and available online at
 */
package com.lap.auth.application.api.command;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@Schema(description = "创建API接口命令")
public class CreateApiCmd {

  @NotBlank(message = "{api.module.required}")
  @Length(max = 32, message = "{api.module.max.length}")
  @Schema(description = "API模块")
  private String module;

  @Length(max = 256, message = "{api.parentCode.max.length}")
  @Schema(description = "父编码")
  private String parentCode;

  @NotBlank(message = "{api.code.required}")
  @Length(max = 256, message = "{api.code.max.length}")
  @Schema(description = "API编码")
  private String code;

  @Length(max = 64, message = "{api.name.max.length}")
  @Schema(description = "API名称")
  private String name;

  @Length(max = 8, message = "{api.method.max.length}")
  @Schema(description = "方法类型:POST,PUT,GET,DELETE")
  private String method;

  @Length(max = 256, message = "{api.uri.max.length}")
  @Schema(description = "API地址")
  private String uri;

  @NotNull(message = "{api.apiType.required}")
  @Range(min = -127, max = 128, message = "{api.apiType.range}")
  @Schema(description = "接口类型:0-MODULE,1-CLASS,2-METHOD")
  private Integer apiType;

  @NotNull(message = "{api.accessLevel.required}")
  @Range(min = -127, max = 128, message = "{api.accessLevel.range}")
  @Schema(description = "访问控制:0-ALL,1-LIMIT")
  private Integer accessLevel;

  @Range(min = -127, max = 128, message = "{api.viewType.range}")
  @Schema(description = "访问类型:0-内部访问,1-外部访问")
  private Integer viewType;
}
